[GoogleMaps] Get GLatLng from GPoint
Posted
by Jo Asakura
on Stack Overflow
See other posts from Stack Overflow
or by Jo Asakura
Published on 2010-03-29T13:11:06Z
Indexed on
2010/03/29
13:13 UTC
Read the original article
Hit count: 607
googlemaps
Hello everybody,
I have a google map with my own map type:
var currentProjection = new GMercatorProjection(maxLevels + 1);
var mapBounds = new GLatLngBounds(new GLatLng(-9, -15), new GLatLng(9, 15));
var custommap = new GMapType(tilelayers, currentProjection, "Some project");
map.addMapType(custommap);
map.setCenter(mapBounds.getCenter(), minLevels, custommap);
When user clicks on map then context menu appears (singlerightclick event), from context menu user can add markers and I need a GLatLng value to add marker to the map but singlerightclick event contains only GPoint value.
I try to use next statement:
map.getCurrentMapType().getProjection().fromPixelToLatLng(pointValueFromEvent, map.getZoom());
but it wasn't helpfull (GLatLng value is outside of my map). I think it's because I use my own map type, how can I get GLatLng value to add the marker?
Best regards, Alex.
© Stack Overflow or respective owner